﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.IO;
using System.Xml;

/// <summary>
///PdaService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。 
// [System.Web.Script.Services.ScriptService]
public class PdaService : System.Web.Services.WebService {
     public   string sasn = "";
     public   string swhseid = "";
     public   string suserid = "";
    public PdaService () {

        //如果使用设计的组件，请取消注释以下行 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string HelloWorld() {

        LicPdaService.App.Log("test", "xxxxxsss");
        return "Hello World";
    }

    //Login
    [WebMethod(Description = "0.0登陆")]
    public string Login(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "登陆");
    }


     //Check
    [WebMethod(Description = "1.0原料到货验收")]
    public string Check(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "原料到货验收");
    }

   

    //putaway
    [WebMethod(Description = "2.0原料上架")]
    public string Putaway(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "原料上架");
    }


    //Print
    [WebMethod(Description = "2.1原料上架打印")]
    public string Print(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "原料上架打印");
    }

    //通过Master label获取库存
    [WebMethod(Description = "3.0获取库存")]
    public string Inventory_Sum(string xml)
    {
       return  LicPdaService.MainHandler.MessageHandler(xml, "ML库存");
        //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><sku_return><userid>admin</userid><whseid>wh1</whseid><master_label>83016000300|PO0001|20160121|200|T03002</master_label><sku>83016000300</sku><label_qty>200</label_qty><qty>200</qty><return_status></return_status></sku_return></NewDataSet>";
    }

    //空箱扫描
    [WebMethod(Description = "3.1空箱扫描")]
    public string Order(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "空箱扫描叫料");
       // return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><order_return><userid>admin</userid><whseid>wh1</whseid><orderkey>HO17012100002</orderkey><return_status>OK</return_status></order_return></NewDataSet>";
    }

    //通过Serial、Master Label获取ASN明细
    [WebMethod(Description = "4.0ASN明细")]
    public string Asn(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "Serial获取ASN");
       // return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><asn_return><userid>admin</userid><whseid>wh1</whseid><serial>815450</serial><asn>HI17030800001</asn><sku>83016000300</sku><qty>100</qty><return_status></return_status></asn_return><asn_return><userid>admin</userid><whseid>wh1</whseid><serial>815450</serial><asn>HI17030800001</asn><sku>83016000300</sku><qty>100</qty><return_status></return_status></asn_return></NewDataSet>";
    }

    //成品上架
    [WebMethod(Description = "4.1成品上架")]
    public string Putaway_Pro(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "成品上架库位");
       // return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><putaway_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><qty>100</qty><storage>RA100201</storage><return_status>OK</return_status></putaway_return><putaway_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><qty>100</qty><storage>RA100201</storage><return_status>OK</return_status></putaway_return></NewDataSet>";
    }

    //成品打印上架标签
    [WebMethod(Description = "4.2成品上架打印标签")]
    public string Print_Pro(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "成品上架打印");
        //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><print_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><batch>20160121</batch><qty>100</qty><storage>RA100201</storage><lpn>L0000001267</lpn><return_status></return_status><page>1</page></print_return><print_return><userid>admin</userid><whseid>wh1</whseid><asn>HI17021300002</asn><serial>815450</serial><sku>83016000300</sku><batch>20160121</batch><qty>100</qty><storage>RA100201</storage><lpn>L0000001267</lpn><return_status></return_status><page>2</page></print_return></NewDataSet>";
    }

    //原料库存查询
    [WebMethod(Description = "5.0原料库存查询")]
    public string Material_Inventory(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "原料库存");
        //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><order_return><userid>admin</userid><whseid>wh1</whseid><master_label>83016000300|PO0001|20160121|200|T03002</master_label><sku>83016000300</sku><qty>100</qty><check_qty>10</check_qty><putaway_qty>20</putaway_qty><backup_qty>10</backup_qty><rejects_qty>5</rejects_qty><return_status>OK</return_status></order_return></NewDataSet>";
    }

    //成品库存查询
    [WebMethod(Description = "6.0成品库存查询")]
    public string Product_Inventory(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "成品库存");
        //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><product_return><userid>admin</userid><whseid>wh1</whseid><serial>000001</serial><sku>83016000300</sku><qty>100</qty><picking_qty>10</picking_qty><rejects_qty>20</rejects_qty><return_status>OK</return_status></product_return></NewDataSet>";
    }

    //7.0.库位转移-库存明细
    [WebMethod(Description = "7.0.库存转移-库存明细查询")]
    public string Search_Inventory(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "ML库存明细");
        //return "<?xml version='1.0' encoding='UTF-8' ?> <NewDataSet><product_return><userid>admin</userid><whseid>wh1</whseid><serial>000001</serial><sku>83016000300</sku><qty>100</qty><picking_qty>10</picking_qty><rejects_qty>20</rejects_qty><return_status>OK</return_status></product_return></NewDataSet>";
    }

    //7.1.库位转移-库位转移
    [WebMethod(Description = "7.1.库位转移-库位转移")]
    public string Move_Inventory(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "库位转移");
    }


    //9.0通过Serial获取出货和库存信息
    [WebMethod(Description = "9.0通过Serial获取出货和库存信息")]
    public string Search_Orders(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "SERIAL库存查询");
    }

    //9.1通过出货-分配库位
    [WebMethod(Description = "9.1通过出货-分配库位")]
    public string Allot_Inventory(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "出货分配库位");
    }

    //9.2通过出货信息-分配库位--库位确认
    [WebMethod(Description = "9.2通过出货信息-分配库位--库位确认")]
    public string AllotConfirm_Inventory(string xml)
    {
        return LicPdaService.MainHandler.MessageHandler(xml, "出货拣货确认");
    }



    //委托打印
    [WebMethod(Description = "委托打印")]
    public string Delegate_Print(string xml)
    {
        
        return LicPdaService.MainHandler.MessageHandler(xml, "委托打印");
    }
   
}
